package com.examine.dao;

import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;

import com.examine.model.User;

public class UserData extends BaseData {
	public User FindUser(String userName) throws SQLException {

		CallableStatement statement = prepareCall("{call UserGetByName(?)}");
		statement.setString(1, userName);

		DataTable resultSet = executeQuery(statement);

		for (DataRow row : resultSet.getRows()) {
			User user = new User();
			user.setUserName(row.get("UserName",String.class));
			user.setUserId(row.get("UserId",Integer.class));
			user.setUserId(row.get("UserId",Integer.class));
			return user;
		}

		return null;
	}
}
